﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TN_CMS.Domain.Entities;

namespace TN_CMS.Domain.Abstract
{
    public interface INewsRepository
    {
        IQueryable<News> News { get; }

        /// <summary>
        /// Get news by page
        /// </summary>
        /// <param name="page">page index</param>
        /// <param name="pageSize">Page size</param>
        /// <returns></returns>
        IQueryable<News> GetList(out int total, int page = 0, int pageSize = 10, bool getInactive = true);

        /// <summary>
        /// Get News by page
        /// </summary>
        /// <param name="pageIndex">page index</param>
        /// <param name="pageSize">Page size</param>
        /// <param name="total">Total page</param>
        /// <param name="orderClause">Order clause</param>
        /// <param name="pageSize">Where clause</param>
        /// <returns></returns>
        List<News> GetList(int pageIndex, int pageSize, out int total, string orderClause, string whereClause);

        /// <summary>
        /// Get news by newsId
        /// </summary>
        /// <param name="id">newsId</param>
        /// <returns></returns>
        News GetDetail(int id, bool getInactive = true);

        /// <summary>
        /// Save news when update or create new news
        /// </summary>
        /// <param name="news">News entity</param>
        /// <param name="actorId">adminId, who save this news</param>
        /// <returns></returns>
        int Save(News news, int actorId);

        /// <summary>
        /// Delete news
        /// </summary>
        /// <param name="ids">News Id(s)</param>
        /// <returns></returns>
        void Delete(int[] ids);

        /// <summary>
        /// Deactive news
        /// </summary>
        /// <param name="id"></param>
        /// <param name="isActive">Active status</param>
        void UpdateActive(int[] ids, bool isActive);
    }
}
